#pragma once

#include <iostream>
#include <string>
#include <functional>

class Task
{
    // 给这种类型的函数起个名(类型)
    using fcntor = std::function<void(int, std::string, uint16_t)> ;
public:
    Task()
        : sock_(-1)
        , port_(-1)
    {}

    Task(int sock, const std::string& ip, uint16_t port, fcntor run)
        : sock_(sock)
        , ip_(ip)
        , port_(port)
        , run_(run)
    {}

    void operator() () 
    {  run_(sock_, ip_, port_); }

    ~Task()
    {}

public:
    int sock_;
    std::string ip_;
    uint16_t port_;
    fcntor run_;
};